<?php
include('config/constants.php');
/*
  |--------------------------------------------------------------------------
  | Application Routes
  |--------------------------------------------------------------------------
  |
  | Here is where you can register all of the routes for an application.
  | It's a breeze. Simply tell Laravel the URIs it should respond to
  | and give it the Closure to execute when that URI is requested.
  |
 */
Route::group(array('before' => 'auth'), function() {
            Route::get('logout', array('as' => 'logout', 'uses' => 'Login@destroy'));

            if (Session::get('quyen') == 'sv') {
                Route::get('sv', function() {
                            return View::make('sinhvien.index')->with('title', 'Trang chủ sinh viên');
                        });
                 Route::get('sv/1', array('as' => 'sv/1', 'uses' => 'SinhVienDsDeTaiLV@index'));   
                 Route::get('sv/1/dsdetai', array('as' => 'sv/1/dsdetai', 'uses' => 'SinhVienDsDeTaiLV@index'));   
                 Route::get('sv/2', array('as' => 'sv/2', 'uses' => 'SinhVienXemDiemDanhGia@index'));    
                 Route::get('sv/2/diem-dg', array('as' => 'sv/2/diem-dg', 'uses' => 'SinhVienXemDiemDanhGia@index')); 
            }

            if (Session::get('quyen') == 'cb') {
               Route::get('cb', function() {
                            return View::make('canbo.index')->with('title', 'Trang chủ cán bộ');
                        });

               Route::get('cb/3', array('as' => 'cb/3', 'uses' => 'CanBoQLDeTaiVaSVDK@index'));   
               Route::get('cb/3/dsdetai', array('as' => 'cb/3/dsdetai', 'uses' => 'CanBoQLDeTaiVaSVDK@index')); 
               Route::post('cb_themdetai',array('uses'=>'CanBoQLDeTaiVaSVDK@Insert_DeTaiLuanVan'));
               Route::post('cb/5/kh/themkehoach',array('uses'=>'CanBoQLKeHoach@them_ke_hoach'));
			Route::post('cb/5/kh/luukehoach',array('uses'=>'CanBoQLKeHoach@luu_ke_hoach'));	
               Route::post('cb/5/kh/suakehoach',array('uses'=>'CanBoQLKeHoach@sua_ke_hoach'));
               Route::post('cb_suadetai',array('uses'=>'CanBoQLDeTaiVaSVDK@update'));
               Route::get('cb/3/dssvdk', array('as' => 'cb/3/dssvdk', 'uses' => 'CanBoQLDeTaiVaSVDK@index1')); 
               Route::get('cb/4', array('as' => 'cb/4', 'uses' => 'CanBoDGVaDBL@index'));
               Route::get('cb/4/dg', array('as' => 'cb/4/dg', 'uses' => 'CanBoDGVaDBL@index'));   
               Route::get('cb/4/bl', array('as' => 'cb/4/bl', 'uses' => 'CanBoDGVaDBL@index1'));
               Route::post('cb/4/bl/duyetbl',array('uses'=>'CanBoDGVaDBL@duyet_bao_luu'));
               Route::get('cb/5/ghidanhgia/{iddt}',array('as'=>'cb/5/ghidanhgia/{iddt}','uses' => 'CanBoDGVaDBL@getThongTinDkdt'));
               Route::get('cb/5', array('as' => 'cb/5', 'uses' => 'CanBoQLKeHoach@index'));   
               Route::get('cb/5/kh', array('as' => 'cb/5/kh', 'uses' => 'CanBoQLKeHoach@index'));   
               Route::get('cb/5/ghikh', array('as' => 'cb/5/ghikh', 'uses' => 'CanBoQLKeHoach@index1')); 

                 Route::get('cb/3', array('as' => 'cb/3', 'uses' => 'CanBoQLDeTaiVaSVDK@index'));   
                 Route::get('cb/3/dsdetai', array('as' => 'cb/3/dsdetai', 'uses' => 'CanBoQLDeTaiVaSVDK@index')); 
                 Route::post('cb_themdetai',array('uses'=>'CanBoQLDeTaiVaSVDK@Insert_DeTaiLuanVan'));
                 Route::post('cb_suadetai',array('uses'=>'CanBoQLDeTaiVaSVDK@update'));
                 Route::get('cb/3/dssvdk', array('as' => 'cb/3/dssvdk', 'uses' => 'CanBoQLDeTaiVaSVDK@index1')); 
                 Route::get('cb/4', array('as' => 'cb/4', 'uses' => 'CanBoDGVaDBL@index'));
                 Route::get('cb/4/dg', array('as' => 'cb/4/dg', 'uses' => 'CanBoDGVaDBL@index'));   
                 Route::get('cb/4/bl', array('as' => 'cb/4/bl', 'uses' => 'CanBoDGVaDBL@index1'));
                 Route::get('cb/4/cb_danhgia', array('uses' => 'CanBoDGVaDBL@DanhGiaCuoiki'));
                 Route::get('cb/5/ghidanhgia/{iddt}',array('as'=>'cb/5/ghidanhgia/{iddt}','uses' => 'CanBoDGVaDBL@getThongTinDkdt'));
                 Route::get('cb/5', array('as' => 'cb/5', 'uses' => 'CanBoQLKeHoach@index'));   
                 Route::get('cb/5/kh', array('as' => 'cb/5/kh', 'uses' => 'CanBoQLKeHoach@index'));   
                 Route::get('cb/5/ghikh', array('as' => 'cb/5/ghikh', 'uses' => 'CanBoQLKeHoach@index1'));
                 Route::get('cb_tuandanhgia',array('as'=>'cb_tuandanhgia','uses' => 'CanBoDGVaDBL@UpdateDanhGiaTuan'));
                 
            }

            if (Session::get('quyen') == 'tbm') {
                Route::get('tbm', function() {
                            return View::make('truongbomon.index')->with('title', 'Trang chủ trưởng bộ môn');
                        });
                 Route::post('tbm/6/phancongdetai', array('uses' => 'TBMPhanCongHDXD@showPhanCong')); 
                 
                 Route::get('tbm/6', array('as' => 'tbm/6', 'uses' => 'TBMPhanCongHDXD@index'));  
                 Route::get('tbm/6/hdxd', array('as' => 'tbm/6/hdxd', 'uses' => 'TBMPhanCongHDXD@index'));
                 Route::get('tbm/6/xoadt', array('as' => 'tbm/6/xoadt', 'uses' => 'TBMXoaDeTai@index'));  
                 Route::post('tbm/6/xoadt', array('before' => 'csrf','uses' => 'TBMXoaDeTai@index'));    
                 Route::get('tbm/6/xemdt/{id}', array('as' => 'tbm/6/xemdt/{id}', 'uses' => 'TBMXoaDeTai@edit'))
                    ->where(array('id' => '[0-9]+'));  
                 Route::post('tbmXoaDeTai', array('before' => 'csrf','uses' => 'TBMXoaDeTai@destroy'));  
                 Route::post('tbmXoaDeTaiCung', array('before' => 'csrf','uses' => 'TBMXoaDeTai@delete')); 
                 Route::post('tbmphancongHD', array('before' => 'csrf','uses' => 'TBMPhanCongHDXD@store')); 
                 
                 Route::get('tbm/7', array('as' => 'tbm/7', 'uses' => 'TBMNhapDiem@index'));   
                 Route::get('tbm/7/nhapdiem', array('as' => 'tbm/7/nhapdiem', 'uses' => 'TBMNhapDiem@index'));  
                 Route::get('tbm/8', array('as' => 'tbm/8', 'uses' => 'TBMThongKe@index'));   
                 Route::get('tbm/8/tkdssv', array('as' => 'tbm/8/tkdssv', 'uses' => 'TBMThongKe@index3'));  
                 Route::get('tbm/8/tkdssvbl', array('as' => 'tbm/8/tkdssvbl', 'uses' => 'TBMThongKe@index1'));  
                 Route::get('tbm/8/tkkqlv', array('as' => 'tbm/8/tkkqlv', 'uses' => 'TBMThongKe@index2'));  
                 Route::get('tbm/8/indssvth', array('as' => 'tbm/8/indssvth', 'uses' => 'TBMThongKe@InTKDSSV'));
                 Route::get('tbm/8/indssvbl', array('as' => 'tbm/8/indssvbl', 'uses' => 'TBMThongKe@InTKDSSVBL'));  
                 Route::get('tbm/8/indskq', array('as' => 'tbm/8/indskq', 'uses' => 'TBMThongKe@InTKKQ'));  
                 Route::get('tbm/8/tkdshdxduyet', array('as' => 'tbm/8/tkdshdxduyet', 'uses' => 'TBMThongKe@index'));  
            }

            if (Session::get('quyen') == 'qtht') {
                Route::get('qtht', function() {
                            return View::make('quantri.index')->with('title', 'Trang chủ quản trị hệ thống');
                        });
                 Route::get('qtht/9', array('as' => 'qtht/9', 'uses' => 'AdminQLNguoiDung@index'));  
                 Route::get('qtht/9/cntk', array('as' => 'qtht/9/cntk', 'uses' => 'AdminQLNguoiDung@index'));
                 Route::get('qtht/10', array('as' => 'qtht/10', 'uses' => 'AdminQLThongBao@index'));  
                 Route::get('qtht/10/qltb', array('as' => 'qtht/10/qltb', 'uses' => 'AdminQLThongBao@index'));  
                 Route::get('qtht/11', array('as' => 'qtht/11', 'uses' => 'AdminQLTGTV@index'));   
                 Route::get('qtht/11/hknk', array('as' => 'qtht/11/hknk', 'uses' => 'AdminQLTGTV@index'));  
                 Route::get('qtht/11/dkdt', array('as' => 'qtht/11/dkdt', 'uses' => 'AdminQLTGTV@index1'));  
                 Route::get('qtht/11/xinbl', array('as' => 'qtht/11/xinbl', 'uses' => 'AdminQLTGTV@index2'));  
                 Route::get('qtht/11/duyetbl', array('as' => 'qtht/11/duyetbl', 'uses' => 'AdminQLTGTV@index3'));  
                 Route::get('qtht/11/lapkhhd', array('as' => 'qtht/11/lapkhhd', 'uses' => 'AdminQLTGTV@index4'));  
                 Route::get('qtht/11/hdxd', array('as' => 'qtht/11/hdxd', 'uses' => 'AdminQLTGTV@index5'));  
                 Route::get('qtht/11/kqdg', array('as' => 'qtht/11/kqdg', 'uses' => 'AdminQLTGTV@index6'));  
                 Route::get('qtht/11/tkbc', array('as' => 'qtht/11/tkbc', 'uses' => 'AdminQLTGTV@index7'));  
                 
                 Route::get('qtht/12', array('as' => 'qtht/12', 'uses' => 'AdminQLLSTV@index'));  
                 Route::get('qtht/12/qllstv', array('as' => 'qtht/12/qllstv', 'uses' => 'AdminQLLSTV@index'));  
            }
        });
Route::group(array('before' => 'guest'), function() {
            Route::get('/', function() {
                        return View::make('index')->with('title', 'Trang chủ quản lý');
                    });
            Route::get('login/{any}', array('as' => 'login/{any}', 'uses' => 'Login@index'))
                    ->where(array('any' => '[A-Za-z]+'));
            Route::post('login', array('before' => 'csrf', 'uses' => 'Login@authen'));
        });





